how to find values in matrix